package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qf.mapper.DtsAdminMapper;
import com.qf.pojo.DtsAdmin;
import com.qf.service.DtsAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DtsAdminServiceImpl implements DtsAdminService {

    @Autowired
    DtsAdminMapper adminMapper;
    @Override
    public DtsAdmin findAdmin(String username) {

        //        QueryWrapper wrapper = new QueryWrapper();
        //               wrapper.eq("username", username);
        //        wrapper.eq("deleted", false);

        LambdaQueryWrapper<DtsAdmin> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(DtsAdmin::getUsername, username);
        wrapper.eq(DtsAdmin::getDeleted, false);

        DtsAdmin admin = adminMapper.selectOne(wrapper);

        return admin;
    }
}
